<?php
/**
 * Created by PhpStorm.
 * User: cy
 * Date: 2017/5/30
 * Time: 12:58
 */

header("Content-type:JSON;charset=utf-8");  //统一输出编码为utf-8
header("Access-Control-Allow-Origin:*");//允许跨域


if(!empty($_GET)&&$_GET["pid"]!=""&&$_GET["pid"]!=null){

    $conne=new mysqli("127.0.0.1","root","","tiangou");

    mysqli_query($conne,"set names utf8");

    $sql="SELECT*FROM products WHERE prostatus=1 AND pid=".$_GET["pid"];

//    print_r($sql);
    $res=$conne->query($sql);

//print_r($res);

    $arrcar=array();
    if($res->num_rows>0){
      while($orow=$res->fetch_assoc()){
         array_push($arrcar,$orow);
      }
    }
    print_r(json_encode($arrcar));
}



